using D.B.Data.API.Applications;
using D.B.Data.Infrastructuse;
using Microsoft.EntityFrameworkCore;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.

builder.Services.AddControllers();


builder.Services.AddDbContext<DataDbContext>(s =>
{
    s.UseSqlServer(builder.Configuration.GetConnectionString("Con"));
});

builder.Services.AddScoped(typeof(IBaseRepository<>), typeof(BaseRepository<>));

builder.Services.AddScoped<IServices,Services>();


var app = builder.Build();

// Configure the HTTP request pipeline.

app.UseAuthorization();

app.UseCors(s => s.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader());
app.MapControllers();

app.Run();
